'use strict';

const Controller = require('egg').Controller;

class whjmessage extends Controller {
  async index() {
    const data = await this.ctx.service.whjmessage.findAll(this.ctx);
    this.ctx.body = data;
  }
  async create() {
    const ctx = this.ctx;
    const params = ctx.request.body;
    const data = await ctx.service.whjmessage.create(params);
    ctx.body = data;
  }
  async destroy() {
    const ctx = this.ctx;
    const whjmessageId = ctx.params.id;
    const del = await ctx.service.whjmessage.delete(whjmessageId);
    ctx.body = del;
  }
  async update() {
    const ctx = this.ctx;
    const whjmessageId = ctx.params.id;
    const params = ctx.request.body;
    const change = await ctx.service.whjmessage.update(whjmessageId, params);
    ctx.body = change;
  }
  async show() {
    const ctx = this.ctx;
    const id = ctx.params.id;
    const whjmessage = await this.ctx.service.whjmessage.find(id);
    ctx.body = whjmessage;
  }
  async index0() {
    const ctx = this.ctx;
    const judge = ctx.params.judge;
    console.log(judge);
    const data = await this.ctx.service.whjmessage.findAll0(judge);
    this.ctx.body = data;
  }
}
module.exports = whjmessage;
